#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

struct node
{
    string name;
    string brithday;
    string gender;
    string fp;
    string mp;
} t[15];
int ss[15];
int n, m;
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> t[i].name >> t[i].brithday >> t[i].gender >> t[i].fp >> t[i].mp;
    }
    cin >> m;
    for (int i = 0; i < m; i++)
        cin >> ss[i];
    for (int i = 0; i < m; i++)
        if (ss[i] >= 0 && ss[i] < n)
        {
            cout << t[ss[i]].name << " " << t[ss[i]].fp << " " << t[ss[i]].mp << " " << t[ss[i]].gender << " " << t[ss[i]].brithday << endl;
        }
        else
        {
            cout << "Not Found" << endl;
        }
    return 0;
}